package mongolo;

import javax.swing.JTextField;
import Servicios.*;
import Biblioteca.*;
import javax.swing.JOptionPane;


public class principal extends javax.swing.JFrame {

    public principal() {
        initComponents();        
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        ConsultarUsua_BTN = new javax.swing.JMenuItem();
        AgregarUsua_BTN = new javax.swing.JMenuItem();
        EditarEliminarUsua_BTN = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        AgregarPeli_BTN = new javax.swing.JMenuItem();
        EditarPeli_BTN = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("principal");
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowActivated(java.awt.event.WindowEvent evt) {
                formWindowActivated(evt);
            }
        });

        jMenu1.setText("Usuarios");

        ConsultarUsua_BTN.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        ConsultarUsua_BTN.setText("Consultar");
        ConsultarUsua_BTN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ConsultarUsua_BTNActionPerformed(evt);
            }
        });
        jMenu1.add(ConsultarUsua_BTN);

        AgregarUsua_BTN.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        AgregarUsua_BTN.setText("Agregar");
        AgregarUsua_BTN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AgregarUsua_BTNActionPerformed(evt);
            }
        });
        jMenu1.add(AgregarUsua_BTN);

        EditarEliminarUsua_BTN.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        EditarEliminarUsua_BTN.setText("Editar / Eliminar");
        EditarEliminarUsua_BTN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                EditarEliminarUsua_BTNActionPerformed(evt);
            }
        });
        jMenu1.add(EditarEliminarUsua_BTN);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Peliculas");

        AgregarPeli_BTN.setText("Agregar Pelicula");
        AgregarPeli_BTN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AgregarPeli_BTNActionPerformed(evt);
            }
        });
        jMenu2.add(AgregarPeli_BTN);

        EditarPeli_BTN.setText("Editar Pelicula");
        EditarPeli_BTN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                EditarPeli_BTNActionPerformed(evt);
            }
        });
        jMenu2.add(EditarPeli_BTN);
        EditarPeli_BTN.getAccessibleContext().setAccessibleName("Editar-Eliminar Pelicula");

        jMenuBar1.add(jMenu2);

        jMenu3.setText("Administradores");
        jMenuBar1.add(jMenu3);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 279, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
    IMapeoObjetos obj = new MapeoObjetos();

    private void formWindowActivated(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowActivated

    }//GEN-LAST:event_formWindowActivated

    private void AgregarUsua_BTNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AgregarUsua_BTNActionPerformed
        new AgregarUsua().setVisible(true);
    }//GEN-LAST:event_AgregarUsua_BTNActionPerformed

    private void EditarEliminarUsua_BTNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EditarEliminarUsua_BTNActionPerformed
        new actualizarUsua().setVisible(true);
    }//GEN-LAST:event_EditarEliminarUsua_BTNActionPerformed

    private void ConsultarUsua_BTNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ConsultarUsua_BTNActionPerformed
        new ConsultaUsuarios().setVisible(true);
    }//GEN-LAST:event_ConsultarUsua_BTNActionPerformed

    private void AgregarPeli_BTNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AgregarPeli_BTNActionPerformed
        new agregarPeli().setVisible(true);
    }//GEN-LAST:event_AgregarPeli_BTNActionPerformed

    private void EditarPeli_BTNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EditarPeli_BTNActionPerformed
        new actualizarPeli().setVisible(true);
    }//GEN-LAST:event_EditarPeli_BTNActionPerformed

    private void limpiarControles(JTextField[] jTF, int pos) {
        for (int i = 0; i < jTF.length; i++) {
            jTF[i].setText("");
        }
        jTF[pos].requestFocus();

    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem AgregarPeli_BTN;
    private javax.swing.JMenuItem AgregarUsua_BTN;
    private javax.swing.JMenuItem ConsultarUsua_BTN;
    private javax.swing.JMenuItem EditarEliminarUsua_BTN;
    private javax.swing.JMenuItem EditarPeli_BTN;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenuBar jMenuBar1;
    // End of variables declaration//GEN-END:variables
}
